package com.lc.qianrenshiye.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/12/12.
 */
@HttpInlet(Conn.STORE_INDEX)
public class BussnessCenterInfoPost extends BaseAsyPost<BussnessCenterInfoPost.BussnessCenterInfoEntity> {

    public String sid;

    public BussnessCenterInfoPost(AsyCallBack<BussnessCenterInfoEntity> asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected BussnessCenterInfoEntity parser(JSONObject object) throws Exception {

        TOAST = object.optString("message");


        if (object.optInt("code") == 200) {

            JSONObject entityObject = object.optJSONObject("data");

            BussnessCenterInfoEntity bussnessCenterInfoEntity = new BussnessCenterInfoEntity();

            bussnessCenterInfoEntity.title = entityObject.optString("title");
            bussnessCenterInfoEntity.picurl = Conn.IMAGE_URL + entityObject.optString("picurl");
            bussnessCenterInfoEntity.gains = entityObject.optString("gains");
            bussnessCenterInfoEntity.todaygains = entityObject.optString("todaygains");
            bussnessCenterInfoEntity.amount = entityObject.optString("amount");
            bussnessCenterInfoEntity.money = entityObject.optString("money");
            bussnessCenterInfoEntity.cost = entityObject.optString("cost");
            bussnessCenterInfoEntity.news = entityObject.optInt("news");

            return bussnessCenterInfoEntity;

        }

        return null;

    }

    public class BussnessCenterInfoEntity {

        public String title, picurl, gains, todaygains, amount, money, cost;
        public int news;

    }
}
